<?php
/* @var $this UsersController */
/* @var $model Users */
/* @var $form CActiveForm */
?>

<?php $form = $this->beginWidget('CActiveForm', array(
    'id' => 'users-form',
    'enableAjaxValidation' => false,
    'htmlOptions' => array(
        'role' => 'form',
        'class' => 'form-horizontal',
    )
)); ?>

<p class="note">Fields with <span class="required">*</span> are required.</p>

<?php if ($model->getErrors()) {
    ?>
    <div class="alert alert-error">
        <button class="close" data-dismiss="alert" type="button"> ×</button>
        <?php echo $form->errorSummary($model); ?>
    </div>
<?php } ?>
<div class="form admin-main-wrapper">
    <div class="block block-themed block-last">
        <div class="block-title">
            <h4></h4>
        </div>
        <div class="block-content">
            <div class="row control-group">
                <?php echo $form->labelEx($model, 'username', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'username', array('size' => 60, 'maxlength' => 150)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'email', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'email', array('size' => 60, 'maxlength' => 100)); ?>
                </div>
            </div>
            <?php if ($model->isNewRecord) { ?>
                <div class="row control-group">
                    <?php echo $form->labelEx($model, 'password', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->passwordField($model, 'password', array('size' => 60, 'maxlength' => 100)); ?>
                    </div>
                </div>
            <?php } ?>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'role', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->dropDownList($model, 'role', array(UserRoleEnum::user => "User", UserRoleEnum::admin => 'Admin',)); ?>
                </div>
            </div>
            <div class="row control-group buttons">
                <div class="controls">
                    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn btn-default')); ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->endWidget(); ?>

